module.exports = {
	// build编译后不生成资源MAP文件
  productionSourceMap: false,
  
  // require('events').EventEmitter.defaultMaxListeners = 0; //解决node内存太小的问题
  //开发服务,build后的生产模式还需nginx代理
  devServer:{
    open:true,
  	//host: "localhost",
	//host: "0.0.0.0",//外网  内网均可访问
    port:8183,
  	allowedHosts: ['s1.v100.vip','localhost','10.0.8.17'],
      proxy:{
          "/api":{
              target:"http://localhost:13933/api",
			  //target:"http://43.139.80.188:13933/api",//代理域名
              changeOrigin:true,
			  ws: false,
              pathRewrite:{
                  '^/api':''
              }
          }
      },
  },
  
  chainWebpack: config => {
  	// 移除 prefetch 插件
  	config.plugins.delete('preload');
  	config.plugins.delete('prefetch');
  	config.resolve.alias.set('vue-i18n', 'vue-i18n/dist/vue-i18n.cjs.js');
  },
  
  configureWebpack: config => {
  	//性能提升
  	config.performance = {
  		hints: false
  	}
  	config.optimization = {
  		splitChunks: {
  			chunks: "all",
  			automaticNameDelimiter: '~',
  			name: true,
  			cacheGroups: {
  				//第三方库抽离
  				vendor: {
  					name: "modules",
  					test: /[\\/]node_modules[\\/]/,
  					priority: -10
  				},
  				elicons: {
  					name: "elicons",
  					test: /[\\/]node_modules[\\/]@element-plus[\\/]icons[\\/]/
  				},
  				tinymce: {
  					name: "tinymce",
  					test: /[\\/]node_modules[\\/]tinymce[\\/]/
  				},
  				echarts: {
  					name: "echarts",
  					test: /[\\/]node_modules[\\/]echarts[\\/]/
  				},
  				xgplayer: {
  					name: "xgplayer",
  					test: /[\\/]node_modules[\\/]xgplayer.*[\\/]/
  				}
  			}
  		}
  	}
  }
}

/* 
部署到nginx，要配置它的转发
参考：https://blog.csdn.net/PhilsphyPrgram/article/details/131723597
*/

/** 互联网 发布配置
module.exports={
    devServer:{
        open:true,
		host: "0.0.0.0",//外网  内网均可访问
        port:13931,
		allowedHosts: ['s1.v100.vip','localhost'],//外部转发许可域名
        proxy:{
            "/api":{
                target:"http://49.233.202.78:13933/api",//代理域名
                changeOrigin:true,
                pathRewrite:{
                    '^/api':''
                }
            }
        }
    }
}
**/